package com.ly.heart.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.EnterainRecordMapper;
import com.ly.heart.service.IEnterainRecordService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.EnterainRecordEntity;

import javax.annotation.Resource;

/**
 * 招待申请Service业务层处理
 *
 * @author cxl
 * @date 2024-06-13
 */
@Service
public class EnterainRecordServiceImpl extends ServiceImpl<EnterainRecordMapper,EnterainRecordEntity> implements IEnterainRecordService {

    @Resource
    private EnterainRecordMapper enterainRecordMapper;

    /**
     * 查询招待申请
     *
     * @param id 招待申请ID
     * @return 招待申请
     */
    @Override
    public EnterainRecordEntity selectEnterainRecordEntityById(String id)
    {
        return enterainRecordMapper.selectEnterainRecordEntityById(id);
    }

    /**
     * 查询招待申请列表
     *
     * @param enterainRecordEntity 招待申请
     * @return 招待申请
     */
    @Override
    public List<EnterainRecordEntity> selectEnterainRecordEntityList(EnterainRecordEntity enterainRecordEntity)
    {
        return enterainRecordMapper.selectEnterainRecordEntityList(enterainRecordEntity);
    }

    /**
     * 新增招待申请
     *
     * @param enterainRecord 招待申请
     * @return 结果
     */
    @Override
    public int insertEnterainRecordEntity(EnterainRecordEntity enterainRecord)
    {
        enterainRecord.setId(SnowflakeIdWorker.getInstance().nextStringId());
        enterainRecord.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
        enterainRecord.setCreateTime(DateUtils.getNowDate());
        return enterainRecordMapper.insertEnterainRecordEntity(enterainRecord);
    }

    /**
     * 修改招待申请
     *
     * @param enterainRecordEntity 招待申请
     * @return 结果
     */
    @Override
    public int updateEnterainRecordEntity(EnterainRecordEntity enterainRecordEntity)
    {
        enterainRecordEntity.setChangeTime(DateUtils.getNowDate());
        return enterainRecordMapper.updateEnterainRecordEntity(enterainRecordEntity);
    }

    /**
     * 批量删除招待申请
     *
     * @param ids 需要删除的招待申请ID
     * @return 结果
     */
    @Override
    public int deleteEnterainRecordEntityByIds(String[] ids)
    {
        return enterainRecordMapper.deleteEnterainRecordEntityByIds(ids);
    }

    /**
     * 删除招待申请信息
     *
     * @param id 招待申请ID
     * @return 结果
     */
    @Override
    public int deleteEnterainRecordEntityById(String id)
    {
        return enterainRecordMapper.deleteEnterainRecordEntityById(id);
    }
}
